package com.shaozi.nc.mq.quartz;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;

import com.shaozi.data.mq.business.base.MqQuartzBean;
import com.shaozi.lib.throwable.SzException;
import com.shaozi.nc.data.model.MqApiQuartzModel;

/**
 * mq的quartz bean跟数据库的model转换
 * 
 * @author brenx
 *
 */
public class QuartzBeanModelUtil {

	private static Logger log = Logger.getLogger(QuartzBeanModelUtil.class);

	private QuartzBeanModelUtil() {

	}

	public static MqQuartzBean modelToBean(MqApiQuartzModel model) {
		MqQuartzBean ret = new MqQuartzBean();
		try {
			BeanUtils.copyProperties(ret, model);
		} catch (IllegalAccessException | InvocationTargetException e) {
			log.error(SzException.getStackMessage(e));
			return null;
		}
		ret.setId(model.getId());
		return ret;
	}

}
